package eletjatek;

import javax.swing.*;
import java.awt.*;

/**
 *
 * @author ZoZo
 */

public class Fault extends JDialog{
    private JButton ok;

    Fault(String e){                    //a hibák kezelésére létrehozott dialog
        this.setTitle("Error");
        this.setMinimumSize(new java.awt.Dimension(e.length()*8+10, 80));
        this.setModal(true);
        this.setName("");
        this.setLocationRelativeTo(null);
        this.setResizable(false);

        FlowLayout lout=new FlowLayout();
        this.setLayout(lout);
        this.add(new JLabel(e));
        ok=new JButton("Ok");
        this.add(ok,BorderLayout.SOUTH);
        ok.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                okActionPerformed(evt);
            }
        });
    }

    private void okActionPerformed(java.awt.event.ActionEvent evt) {
        this.setVisible(false);
        this.dispose();
    }

}
